Skip to content

if input = array, return parsed to string#136

Open
oliverstasa wants to merge 6 commits intodevelopfrom
feat/array_input
Open

if input = array, return parsed to string#136
oliverstasa wants to merge 6 commits intodevelopfrom
feat/array_input

Conversation

@oliverstasa
Copy link
Copy Markdown
Member

in case of multilangual inputs, parse array in input to json string:
input :
{"description": {"en": "test1", "cz": "test1"} }
===>
db output:
"description": "{"en":"test1","cz":"test1"}"

@oliverstasa oliverstasa requested a review from pchalupa as a code owner May 19, 2021 12:39
@oliverstasa
Copy link
Copy Markdown
Member Author

i don't get it ==> phpstan says its always true but it isn't, it works when tested

return array_key_exists($key, $this->body) ? $this->body[$key] : $default;
// return array_key_exists($key, $this->body) ? json_encode($this->body[$key]) : $default;
if (array_key_exists($key, $this->body)) {
if (is_string($this->body[$key])) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.body is array of strings, so it will always be string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants